<?php


require_once(dirname(__FILE__) . '/include.php');

$query = 'SELECT id FROM graph WHERE number_of_vertices BETWEEN 100 AND 300';
$graphs = $GLOBALS['db']->fetchAll($query);

foreach ($graphs as $gr) {
//	for ($i = 0; $i < 5; $i++) {
		$graph = new DBGraph($gr['id']);
		$start = microtime(true);
		$lulco = new Lulco();
		$best = $lulco->coloring($graph);
		$end = microtime(true);
		
		if ($best) {
			echo $best->getColorsCount();
			var_dump($best->check());
			$params = array(
				'algorithm' => 3,
				'graph' => $best->getDbId(),
				'found_chromatic_number' => $best->getColorsCount(),
				'duration' => $end - $start,
				'coloring' => $best->getSerializedColors(),
			);
			
			if ($best->check()) {
				$params['good'] = 1;
			}
			
			$GLOBALS['db']->insert('chromatic_number', $params);
		}
//	}
}
?>